package org.example;

import org.example.entity.ParkingLot;
import org.example.entity.Vehicle;

import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class Main {
    public static void main(String[] args) {
        int batchSize = 20;
        CountDownLatch latch = new CountDownLatch(20);
        ExecutorService threadPool= Executors.newFixedThreadPool(batchSize);

        ParkingLot parkingLot=new ParkingLot(2,3,10);

        for (int i = 0; i < 20; i++) {
            threadPool.execute(new Vehicle(parkingLot,latch));
            latch.countDown();
        }

        threadPool.shutdown();
    }
}